/**
 * @file 线段树 单点修改 区间查询
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @brief
 * @version 1.0
 * @date 2022-05-14
 * @see https://www.luogu.com.cn/record/75750974
 *
 * @copyright Copyright (c) 2022
 *
 **/

#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 5e5 + 10;
int a[N];
struct SegTree {
  struct node {
    int l, r, dat;
  } t[N * 4];
  void maintain(int p) { t[p].dat = t[p * 2].dat + t[p * 2 + 1].dat; }
  void build(int p, int l, int r) {
    t[p].l = l, t[p].r = r;
    if (l == r) {
      t[p].dat = a[l];
      return;
    }
    int mid = (l + r) / 2;
    build(p * 2, l, mid), build(p * 2 + 1, mid + 1, r);
    maintain(p);
  }
  void change(int p, int x, int v) {
    if (t[p].l == t[p].r) {
      t[p].dat += v;
      return;
    }
    int mid = (t[p].l + t[p].r) / 2;
    if (x <= mid)
      change(p * 2, x, v);
    else
      change(p * 2 + 1, x, v);
    maintain(p);
  }
  int ask(int p, int l, int r) {
    if (l <= t[p].l && r >= t[p].r) return t[p].dat;
    int mid = (t[p].l + t[p].r) / 2;
    int val = 0;
    if (l <= mid) val += ask(p * 2, l, r);
    if (r > mid) val += ask(p * 2 + 1, l, r);
    return val;
  }
} T;
signed main() {
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  T.build(1, 1, n);
  while (q--) {
    int op, x, y;
    cin >> op >> x >> y;
    if (op == 1) {
      T.change(1, x, y);
    } else {
      cout << T.ask(1, x, y) << endl;
    }
  }
}
